Ext.namespace("Maint.Show61");

Maint.Show61.showInfo = function (){
	this.selectItems = new Ext.data.SimpleStore({
        fields: ['value', 'text'],
        data: []
    });

	/* basic info */
    this.txtWoNum = new Ext.form.TextField({fieldLabel: '工单流水号',readOnly: true,width: 160 });
    this.txtCreateBy = new Ext.form.ComboBox({fieldLabel: '派单人',readOnly: true,width: 160,store: this.selectItems,xtype: 'combo' });
    this.txtContact = new Ext.form.TextField({fieldLabel: '联系方式',readOnly: true,width: 160 });
    this.txtDept = new Ext.form.TextField({fieldLabel: '派单部门',readOnly: true,width: 160 });
    this.txtCreateTime = new Ext.form.DateField({fieldLabel: '派单时间',width: 160,format: 'Y-m-d',disabledDays: [0-6]});
    this.txtTopic = new Ext.form.TextArea({fieldLabel: '工单主题',readOnly: true,width: 460,height: 40 });
    /* expand info */
    this.txtFaultFindTime = new Ext.form.DateField({fieldLabel: '故障发现时间',width: 160,format: 'Y-m-d',disabledDays: [0-6]});
    this.txtFaultLocation = new Ext.form.TextField({fieldLabel: '报障属地',readOnly: true,width: 160 });
    this.txtFaultEndTime = new Ext.form.DateField({fieldLabel: '故障结束时间',width: 160,format: 'Y-m-d',disabledDays: [0-6]});
    this.txtUrgency = new Ext.form.TextField({fieldLabel: '紧急程度',readOnly: true,width: 160 });
    this.txtFalutType = new Ext.form.TextField({fieldLabel: '故障类型',readOnly: true,width: 160 });
    this.txtTransferType = new Ext.form.TextField({fieldLabel: '传输属性',readOnly: true,width: 160 });
    this.txtFaultReason = new Ext.form.TextField({fieldLabel: '故障原因细分',readOnly: true,width: 160 });
    this.txtGrid = new Ext.form.TextField({fieldLabel: '网元',readOnly: true,width: 160 });
    this.txtMaintenanceDep = new Ext.form.TextField({fieldLabel: '维护部门',readOnly: true,width: 160 });
    this.txtMaintenanceUnit = new Ext.form.TextField({fieldLabel: '维护单位',readOnly: true,width: 160 });
    this.txtEffectNum = new Ext.form.TextField({fieldLabel: '影响类型和数量',readOnly: true,width: 160 });
    this.txtEffectRange = new Ext.form.TextField({fieldLabel: '影响范围',readOnly: true,width: 160 });
    this.txtPretreatment = new Ext.form.TextField({fieldLabel: '预处理情况和处理建议',readOnly: true,width: 460 });
    this.txtNetworkType = new Ext.form.TextField({fieldLabel: '网络类型',readOnly: true,width: 160 });
    this.txtFalutDes = new Ext.form.TextField({fieldLabel: '故障描述',readOnly: true,width: 460 });
    this.txtReplyCon = new Ext.form.TextArea({fieldLabel: '回复内容',readOnly: true,width: 460,height: 40 });
    this.txtPigeonholeTime = new Ext.form.DateField({fieldLabel: '归档时间',width: 160,format: 'Y-m-d',disabledDays: [0-6]});
    this.txtPigeonholeNotion = new Ext.form.TextField({fieldLabel: '归档意见',readOnly: true,width: 460 });
    
    this.colseButton = new Ext.Button({
		text:"关闭",
		handler:function(){
			this.hide();
		},
		scope:this
	});

	this.basicPanel = new Ext.form.FormPanel({
		title:'工单基本信息',
		autoHeight:true,
		autoWidth :true,
		labelWidth: 130,
		labelAlign:'right',
		region:'north',
		layout:'table',
		split:true,
		collapsible: true,
		frame:true,
		layoutConfig:{columns:2},
		style:{algin:'center'},
		items:[
			       {layout: 'form',items: [this.txtWoNum]},
			       {layout: 'form',items: [this.txtCreateBy]},
			       {layout: 'form',items: [this.txtContact]},
			       {layout:'form',items:[this.txtDept]},
			       {colspan: 2,layout:'form',items:[this.txtTopic]},
			       {layout:'form',items:[this.txtCreateTime]}
		]
	});
	
	this.expandPanel = new Ext.form.FormPanel({
		title:'工单扩展信息',
		autoHeight:true,
		autoWidth :true,
		labelWidth: 130,
		labelAlign:'right',
		region:'north',
		layout:'table',
		split:true,
		collapsible: true,
		frame:true,
		layoutConfig:{columns:2},
		style:{algin:'center'},
		items:[
			       {layout: 'form',items: [this.txtFaultFindTime]},
			       {layout: 'form',items: [this.txtFaultLocation]},
			       {layout: 'form',items: [this.txtFaultEndTime]},
			       {layout: 'form',items: [this.txtUrgency]},
			       {layout: 'form',items: [this.txtFalutType]},
			       {layout: 'form',items: [this.txtTransferType]},
			       {layout: 'form',items: [this.txtFaultReason]},
			       {layout: 'form',items: [this.txtGrid]},
			       {layout: 'form',items: [this.txtMaintenanceDep ]},
			       {layout: 'form',items: [this.txtMaintenanceUnit]},
			       {layout: 'form',items: [this.txtEffectNum]},
			       {layout: 'form',items: [this.txtEffectRange]},
				   {colspan: 2,layout: 'form',items: [this.txtNetworkType]},
			       {colspan: 2,layout: 'form',items: [this.txtPretreatment]},
			       {colspan: 2,layout: 'form',items: [this.txtFalutDes]},
			       {colspan: 2,layout: 'form',items: [this.txtReplyCon]},
			       {colspan: 2,layout: 'form',items: [this.txtPigeonholeNotion]},
			       {colspan: 2,layout: 'form',items: [this.txtPigeonholeTime]}
		]
	});  

	this.mainPanel= new Ext.Panel({
		//height: bodyHeight-70,
		autoScroll: true,
		items: [this.basicPanel, this.expandPanel]
	}); 
	
	Maint.Show61.showInfo.superclass.constructor.call(this,{
		width:680,
		height:570,
		modal:true,
		autoScroll:false,
		closeAction:'hide',
		buttonAlign:'right',
		buttons:[this.colseButton],
		items:[this.mainPanel],
		listeners:{
		}
	});
	
};

Ext.extend(Maint.Show61.showInfo, Ext.Window, {
	initDetail:function(data){
		this.maintId = data.MAINT_ID;
		this.txtWoNum.setValue(data.WO_NUM);
		this.txtCreateBy.setValue(data.CREATE_BY);
    	this.txtContact.setValue(data.CONTACT);
    	this.txtDept.setValue(data.CREATE_DEP);
    	this.txtCreateTime.setValue(data.CREATE_TIME);
    	this.txtTopic.setValue(data.TOPIC);
    	this.txtFaultFindTime.setValue(data.FAULT_FIND_TIME);
    	this.txtFaultLocation.setValue(data.FAULT_LOCATION);
   	 	this.txtFaultEndTime.setValue(data.FAULT_END_TIME);
    	this.txtUrgency.setValue(data.URGENCY);
    	this.txtFalutType.setValue(data.FALUT_TYPE);
    	this.txtTransferType.setValue(data.TRANSFER_TYPE);
    	this.txtFaultReason.setValue(data.FAULT_REASON);
    	this.txtGrid.setValue(data.GRID);
    	this.txtMaintenanceDep.setValue(data.MAINTENANCE_DEP);
    	this.txtMaintenanceUnit.setValue(data.MAINTENANCE_UNIT);
    	this.txtEffectNum.setValue(data.EFFECT_NUM);
	    this.txtEffectRange.setValue(data.EFFECT_RANGE);
	    this.txtPretreatment.setValue(data.PRETREATMENT);
	    this.txtNetworkType.setValue(data.NETWORK_TYPE);
	    this.txtFalutDes.setValue(data.FALUT_DES);
	    this.txtReplyCon.setValue(data.REPLY_CON);
	    this.txtPigeonholeTime.setValue(data.PIGEONHOLE_TIME);
	    this.txtPigeonholeNotion.setValue(data.PIGEONHOLE_NOTION);
	}
});